package com.twu.biblioteca.options;

import com.twu.biblioteca.Option;
import com.twu.biblioteca.User;
import com.twu.biblioteca.UserInterface;
import com.twu.biblioteca.UserRepository;

public class ShowMembershipDetailsOption implements Option {
    private UserRepository userRepository;
    private UserInterface userInterface;

    public ShowMembershipDetailsOption(UserRepository userRepository, UserInterface userInterface) {
        this.userRepository = userRepository;
        this.userInterface = userInterface;
    }

    @Override
    public void Execute() {
        User authenticatedUser = this.userRepository.getAuthenticatedUser();

        this.userInterface.showMessage("Name: " + authenticatedUser.getName());
        this.userInterface.showMessage("Email: " + authenticatedUser.getEmail());
        this.userInterface.showMessage("Phone number: " + authenticatedUser.getPhoneNumber());
    }

    @Override
    public String toString() {
        return "Check my membership details";
    }
}
